package com.lwq.commentTool.model;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

public class CookItemModel {
	private Map<String,List<String>> Content = null;

	public CookItemModel() {
		if(Content == null){
			Content = new HashMap<String,List<String>>();
		}
	}
	
	public String getRandomText(String type) {
		String RandomText = null;
		if(Content != null){
			List<String> list = Content.get(type);
			int index = 0;
			if(list != null){
				index = getRandomNumber(list.size());
				RandomText = list.get(index);
			}
		}
		return RandomText;
	}
	
	public int getRandomNumber(int size) {
		Date date = new Date();
		Random random = new Random(date.getTime());
		int intRand = random.nextInt();
		return Math.abs(intRand)%size;
	}
}






